package cn.wolfcode.p2p.bussness.service.impl;



import cn.wolfcode.p2p.base.query.PlatformBankInfoQueryObject;
import cn.wolfcode.p2p.base.query.QueryObjext;
import cn.wolfcode.p2p.bussness.domain.PlatformBankInfo;
import cn.wolfcode.p2p.bussness.mapper.PlatformBankInfoMapper;
import cn.wolfcode.p2p.bussness.service.IPlatformBankInfoService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service@Transactional
public class PlatformBankInfoServiceImpl implements IPlatformBankInfoService {
	@Autowired
	private PlatformBankInfoMapper platformBankInfoMapper;

	@Override
	public int save(PlatformBankInfo platformBankInfo) {
		return platformBankInfoMapper.insert(platformBankInfo);
	}

	@Override
	public int update(PlatformBankInfo platformBankInfo) {
		return platformBankInfoMapper.updateByPrimaryKey(platformBankInfo);
	}


	@Override
	public int saveOrUpdate(PlatformBankInfo platformBankInfo) {
		if(platformBankInfo.getId()==null){
			return this.save(platformBankInfo);
		}else{
			return this.update(platformBankInfo);
		}
	}

	@Override
	public PageInfo queryPage(PlatformBankInfoQueryObject qo) {
		PageHelper.startPage(qo.getPageNum(),qo.getPageSize());
		List list = this.platformBankInfoMapper.queryList(qo);
		return new PageInfo(list);
	}

	@Override
	public List<PlatformBankInfo> selectAll() {
		return platformBankInfoMapper.selectAll();
	}
}
